package com.mxsat.system.service.impl;

import java.util.HashMap;
import java.util.List;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import com.baomidou.mybatisplus.core.metadata.IPage;
import com.mxsat.system.dao.SysMenuDao;
import com.mxsat.system.entity.SysMenu;
import com.mxsat.system.service.SysMenuService;

@Service
public class SysMenuServiceImpl implements SysMenuService {

	@Autowired
	private SysMenuDao sysMenuDao;

	@Override
	public List<SysMenu> findSysMenuByAll() throws Exception {
		return sysMenuDao.selectMenuByAll();
	}

	@Override
	public IPage<SysMenu> findSysMenusByPage(IPage<SysMenu> page) throws Exception {
		return sysMenuDao.selectMenuByPage(page, new HashMap<>());
	}

	@Override
	public SysMenu findSysMenuById(Long id) throws Exception {
		return sysMenuDao.getById(id);
	}

	@Override
	public boolean addSysMenu(SysMenu menu) throws Exception {
		return sysMenuDao.save(menu);
	}

	@Override
	public boolean modifySysMenu(SysMenu menu) throws Exception {
		return sysMenuDao.updateById(menu);
	}

}
